package com.webcash.CNBoard.Repository;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.webcash.CNBoard.Model.ProjectFile;

@Repository
public class ProjectFileRepositoryImpl extends SqlSessionDaoSupport implements ProjectFileRepository {

	public void insertProjectFilebyProjectFile(ProjectFile file) {
		SqlSession session = getSqlSession();
		session.insert("ProjectFile.insertProjectFile", file);
	}
	
	public List<ProjectFile> getProjectFileList(int projectNo){
		SqlSession session = getSqlSession();
		return session.selectList("ProjectFile.selectProjectFileList", projectNo);
		
	}

	public void deleteProjectFilebyFileNo(ProjectFile file) {
		SqlSession session = getSqlSession();
		session.delete("ProjectFile.deleteFilebyNo", file.getFileNo());
		
	}

	public ProjectFile selectProjectFileByFileNo(int fileNo) {
		SqlSession session = getSqlSession();
		return session.selectOne("ProjectFile.selectProjectFileByFileNo", fileNo);
	}

	public int selectLastProjectFile() {
		SqlSession session = getSqlSession();
		return session.selectOne("ProjectFile.selectLastProjectFileNo");
	}
	
	
}
